Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

profane

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

profane

A profanity detector.

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

profane

A profanity detector.

Usage


var Profane = require('profane');
var p = new Profane();

// get the set of all inappropriate words in a string
var wordCounts = p.getWordCounts("hell no dude");
console.log(wordCounts);

/*

{
  'hell': 1,
  'dude': 1,
}

*/

// get an associative array of all of categories found,
// where the key is the category and the value is the number
// of words found for that category
var categoryCounts = p.getCategoryCounts("hell no dude");
console.log(categoryCounts);

/*

{
  'inappropriate': 1,
  'informal': 1,
  'religious': 1,
}

*/

p.addWord("nasty", ["inappropriate", "gross"]);
wordCounts = p.getWordCounts("you are nasty");
console.log(wordCounts);

/*
{
  'nasty': 1,
}
*/


if (p.wordHasCategory("nasty", "gross")) {
  console.log("This will be printed");
}

p.removeWord("nasty");

if (p.hasWord("nasty")) {
  console.log("This won't be printed");
}

p.clearWords();
if (p.hasWord("hell")) {
  console.log("This won't be printed");
}

p.addWord("hell", ["religious"]);
p.addCategoriesForWord("hell", ["inappropriate"]);
p.removeCategoriesForWord("hell", ["religious"]);
p.setCategoriesForWord("hell", ["inappropriate", "religious"]);


Keywords

FAQs

Package last updated on 27 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc